package com.example.videoweb.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

//解决跨域问题
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping(("/**"))
                .allowedOriginPatterns("*")      //允许所有网站跨域访问
                .allowedMethods("*")      //允许所有方法跨域访问
                .allowCredentials(true);  //访问是否验证
    }
}
